<f:view
		xmlns="http://www.w3.org/1999/xhtml"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:a4j="http://richfaces.org/a4j"
		xmlns:rich="http://richfaces.org/rich"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:itdep="http://itdep.bsuir.by/jsf" xmlns:c="http://java.sun.com/jstl/core"
		>

	<ui:decorate template="/facelets/template/mainTemplate.xhtml">
		<f:loadBundle basename="bundle.department" var="departmentBundle"/>

		<ui:param name="title" value="Plan details"/>
		<ui:define name="center">
			<ui:decorate template="/facelets/template/centerTemplate.xhtml">

				<ui:define name="content">
					<f:loadBundle basename="bundle.plan" var="plansBundle"/>
					<ui:decorate template="/facelets/template/planPanelTemplate.xhtml">
					</ui:decorate>
					<a4j:form>
						<a4j:commandLink value="#{plansBundle.backToContentPlans}" action="toPlanDetails"/>
					</a4j:form>
					<h:panelGrid styleClass="centerHeader">
						<itdep:entityOutput value="#{semesterPlanBean.contentPlan.subject}" format="{i18n.fullName}"
											locale="#{subjectDicBean.translationBean.locale}"/>
					</h:panelGrid>
					<ui:decorate template="/facelets/template/dataTableTemplate.xhtml">
						<ui:param name="idPrefix" value="semesterPlanList"/>
						<ui:param name="actionBean" value="#{semesterPlanBean}"/>


						<ui:define name="tableContext">
							<f:facet name="header">
								<rich:columnGroup>
									<rich:column width="1%" rowspan="3">
										<h:outputText value="#{plansBundle.number}"/>
									</rich:column>
									<rich:column width="1%" rowspan="3">
										<h:outputText value="#{plansBundle.semester}"/>
									</rich:column>
									<rich:column width="1%" rowspan="3">
										<h:outputText value="#{plansBundle.coursePart}"/>
									</rich:column>

									<rich:column colspan="#{semesterPlanBean.lesTypeSize+2}" rowspan="1">
										<h:outputText value="#{plansBundle.quantityHours}"/>
									</rich:column>
									<c:forEach items="#{semesterPlanBean.formOfControl}" var="formCtrl">

										<rich:column rowspan="3">

											<itdep:entityOutput value="#{formCtrl}" format="{i18n.fullName}"
																locale="#{formOfControlDicBean.translationBean.locale}"/>
										</rich:column>


									</c:forEach>
									<rich:column width="1%" rowspan="3">
										<rich:spacer/>
									</rich:column>
									<rich:column width="1%" rowspan="3">
										<rich:spacer/>

									</rich:column>
									<rich:column width="1%" breakBefore="true" rowspan="2">
										<h:outputText value="#{plansBundle.allHours}"/>
									</rich:column>
									<rich:column width="1%" rowspan="2">
										<h:outputText value="#{plansBundle.auditHours}"/>
									</rich:column>
									<rich:column colspan="#{semesterPlanBean.lesTypeSize}">
										<h:outputText value="#{plansBundle.fromWhich}"/>
									</rich:column>
									<c:forEach items="#{semesterPlanBean.lessonTypes}" var="lesType" varStatus="status">
										<c:if test="#{status.index==0}">
											<rich:column breakBefore="true">


												<itdep:entityOutput value="#{lesType}" format="{i18n.fullName}"
																	locale="#{lessonTypeDicBean.translationBean.locale}"/>

											</rich:column>
										</c:if>
										<c:if test="#{status.index!=0}">
											<rich:column>

												<itdep:entityOutput value="#{lesType}" format="{i18n.fullName}"
																	locale="#{lessonTypeDicBean.translationBean.locale}"/>

											</rich:column>
										</c:if>

									</c:forEach>


								</rich:columnGroup>
							</f:facet>

							<rich:column width="1%">
								<h:outputText value="#{record.id}"/>
							</rich:column>

							<rich:column width="21%">
								<h:outputText value="#{record.term}"/>
							</rich:column>
							<rich:column width="21%">
								<h:outputText value="#{record.coursePartNumber}"/>
							</rich:column>

							<rich:column width="21%">
								<h:outputText value="#{record.allHours}"/>
							</rich:column>
							<rich:column width="21%">
								<h:outputText value="#{record.auditHours}"/>
							</rich:column>

							<c:forEach items="#{semesterPlanBean.lessonTypes}" var="lesType">
								<rich:column>

									<h:outputText value="#{record.typeMap[lesType.code]}"/>
								</rich:column>

							</c:forEach>
							<c:forEach items="#{semesterPlanBean.formOfControl}" var="formCtrl">
								<rich:column>

									<h:outputText value="#{record.typeMap[formCtrl.code]}"/>
								</rich:column>

							</c:forEach>

							<rich:column width="21%">

								<h:commandLink value="#{plansBundle.details}"
											   action="#{semesterPlanBean.showControlPlans}"/>
							</rich:column>
							<rich:column width="1%">
								<h:panelGroup style="white-space:nowrap;">
									<a4j:commandLink value="#{commonBundle.edit}" action="#{semesterPlanBean.edit}"
													 reRender="#{idPrefix}TablePanel" immediate="true"/>
									<rich:spacer width="7"/>
									<a4j:commandLink value="#{commonBundle.delete}" action="#{semesterPlanBean.delete}"
													 reRender="#{idPrefix}TablePanel" immediate="true"/>
								</h:panelGroup>
							</rich:column>

						</ui:define>
					</ui:decorate>
				</ui:define>


			</ui:decorate>

		</ui:define>
	</ui:decorate>

</f:view>